package com.example.databindingtest.api

import okhttp3.OkHttpClient
import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory
import java.util.concurrent.TimeUnit

/*
 * class title: 
 * Author by RenChunLin, Email 18957806320@163.com, Date on 2021/4/29.
 * PS: Not easy to write code, please indicate.
 */
object RetrofitClient {

    const val BASE_URL = "https://api.sunofbeach.net/shop/"

    private val okHttpClient = OkHttpClient.Builder()
        .callTimeout(30, TimeUnit.SECONDS)
        .build()

    //retrofit
    private val retrofit = Retrofit.Builder()
        .baseUrl("https://api.sunofbeach.net/shop/")
        .addConverterFactory(GsonConverterFactory.create())
        .client(okHttpClient)
        .build()

    val apiService = retrofit.create(ApiService::class.java)
}